import sys
import subprocess


def check_python_version():
    print("Python version:", sys.version)


def check_package(pkg_name):
    try:
        __import__(pkg_name)
        print(f"[OK] {pkg_name} installed")
    except ImportError:
        print(f"[MISSING] {pkg_name} not installed")


def check_command(cmd):
    try:
        result = subprocess.run([cmd, "--version"], capture_output=True, text=True)
        print(f"[OK] {cmd}: {result.stdout.strip()}")
    except FileNotFoundError:
        print(f"[MISSING] {cmd} not found in PATH")


if __name__ == "__main__":
    check_python_version()
    for pkg in ["cv2", "numpy", "tqdm", "paddleocr"]:
        check_package(pkg)
    for tool in ["ffmpeg", "yt-dlp"]:
        check_command(tool)

